package cn.edu.nchu.fragmentdemo.db.server;

import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.stmt.QueryBuilder;

import java.sql.SQLException;

import cn.edu.nchu.fragmentdemo.bean.Route;

/**
 * @className: RouteServer
 * @description: TODO 类描述
 * @author: Kuangkeli
 * @date: 2023/10/13 10:48
 **/
public class RouteServer {


    public static  Integer getRouteIdByRouteTaskId(Integer routeTaskId, Dao<Route, Integer> routeDao){
        try {
            QueryBuilder<Route, Integer> queryBuilder = routeDao.queryBuilder();
            queryBuilder.where().eq("route_task_id", routeTaskId);
            Route route = queryBuilder.queryForFirst();
            if (route != null) {
                return route.getId();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
